package com.project.mapper;

import com.project.bean.ProductBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Title: IProductMapper
 * @Package: com.project.mapper
 * @Description:
 * @Author: Liang-Xie
 * @Date: 2022/7/13 - 17:31
 */
@SuppressWarnings("all")
public interface IProductMapper {
    @Insert("insert into t_product(p_name,p_createDate,p_price)" +
            "values(#{name},#{createDate},#{price})")
    public void add(ProductBean productBean);
    @Delete("delete from t_product where pk_productId=#{id}")
    public void del(Integer id);
    @Update("update t_product set p_price=#{price} where pk_productId=#{id}")
    public void update(@Param("id") Integer id, @Param("price") Integer price);
    @Select("select * from t_product")
    @ResultMap("productMap")
    public List<ProductBean> findAll();
    @Select("select * from t_product where pk_productId=#{id}")
    @ResultMap("productMap")
    public ProductBean findById(Integer id);
}
